"""
系统配置模式，用于请求/响应验证
"""
from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime
from uuid import UUID


class SystemConfigBase(BaseModel):
    """系统配置基础模式"""
    config_key: str = Field(..., min_length=1, max_length=100)
    config_value: str = Field(..., min_length=1)
    description: Optional[str] = None


class SystemConfigCreate(SystemConfigBase):
    """创建系统配置的模式"""
    pass


class SystemConfigUpdate(BaseModel):
    """更新系统配置的模式"""
    config_value: str = Field(..., min_length=1)
    description: Optional[str] = None


class SystemConfigResponse(SystemConfigBase):
    """系统配置响应模式"""
    id: UUID
    created_at: datetime
    updated_at: datetime
    
    class Config:
        from_attributes = True


class AdminPasswordVerify(BaseModel):
    """管理员密码验证模式"""
    password: str = Field(..., min_length=1)


class AdminPasswordUpdate(BaseModel):
    """管理员密码更新模式"""
    old_password: str = Field(..., min_length=1)
    new_password: str = Field(..., min_length=6, max_length=100)
